/*!
 *  @brief     处理任务
 *  @details   继承自QThread，根据不同的处理类型，派生出不同的子类
 *  @author    Will.Yin
 *  @version   v1.0
 *  @date      2022-01-11
 *  @copyright Eoslift.
 *  @note
 */
#ifndef TASKTHREAD_H
#define TASKTHREAD_H

#include "common_global.h"

#include <QThread>

namespace Common {

class TaskThread : public QThread
{
    Q_OBJECT
public:
    explicit TaskThread(QObject *parent = Q_NULLPTR);
    ~TaskThread();

    enum TaskState {
        IdleState,              //任务未启动
        StartState,             //任务运行中
        StoppedState            //任务停止
    };

public:
    bool running();

    virtual void startTask();
    virtual void stopTask();

signals:
    void stateChanged(TaskState state);

protected:
    TaskState taskState;

    bool runningFlag;
};

}//namespace Common

#endif // TASKTHREAD_H
